/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mygame;

import com.jme3.asset.AssetManager;
import com.jme3.light.DirectionalLight;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.shape.Sphere;
import com.jme3.system.AppSettings;
import com.jme3.ui.Picture;

/**
 *
 * @author dani
 */
public class GuiManager {
    private AssetManager assetManager;
    private Node guiNode;
    
    private final int CH_SIZE = 40;
    private static final String CROSSHAIR_FILE_PATH ="Interface/crosshair2.png";
    public static final String CROSSHAIR_NAME ="crosshair";
    
    
    public GuiManager(Node guiNode, AssetManager assetManager){
        this.guiNode = guiNode;
        this.assetManager = assetManager;
    }

    public void setUpGui() {
    }

    /**
     * A centred plus sign to help the player aim.
     */
    protected void initCrossHairs( AppSettings settings) {
        Picture ch = new Picture(CROSSHAIR_NAME);
        ch.setImage(assetManager, CROSSHAIR_FILE_PATH, true);
//        ch.setWidth();
//        ch.setHeight(settings.getHeight() / 2);
        ch.setHeight(CH_SIZE);
        ch.setWidth(CH_SIZE);
//        ch.setLocalTranslation( settings.getWidth() / 2 - CH_SIZE/2, settings.getHeight() / 2 + CH_SIZE/2, 0);
        ch.setPosition(settings.getWidth() / 2 - CH_SIZE/2, settings.getHeight() / 2 - CH_SIZE/2);
        guiNode.attachChild(ch);
    }
    
    protected void initWeapon(){
        Spatial gun = assetManager.loadModel("Models/weapons/Conrad_Gun/Conrad_gun.j3o");
        gun.scale(100f, 100f, 100f);
//        gun.rotate(0.0f, -3.0f, 0.0f);
        gun.setLocalTranslation(0.0f, 5.0f, 5f);
        guiNode.attachChild(gun);
        
        DirectionalLight sun = new DirectionalLight();
        sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
        guiNode.addLight(sun);
        
        
        Sphere sphere = new Sphere(30, 30, 0.2f);
        Geometry mark = new Geometry("BOOM!", sphere);
        Material mark_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mark_mat.setColor("Color", ColorRGBA.Red);
        mark.setMaterial(mark_mat);
        mark.move(0, 0, -5);
        guiNode.attachChild(mark);
    }
}
